package com.geccocrawler.gecco.demo.anjuke;

import com.geccocrawler.gecco.GeccoEngine;
import com.geccocrawler.gecco.annotation.*;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.HtmlBean;

import java.util.List;

/**
 * Created by 抽离 on 2017/5/20 0020.
 */
@Gecco(matchUrl = "http://xm.anjuke.com/tycoon/p{page}/", pipelines={"consolePipeline", "nextPipeline"})
public class Anjuke implements HtmlBean {

    @Request
    public HttpRequest httpRequest;

    @RequestParameter
    private int page;

    @Attr("link")
    @HtmlField(cssPath = ".jjr-itemmod")
    private List<String> url;

    @Text
    @HtmlField(cssPath = ".jjr-title>h3>a")
    private List<String> jjrname;

    @Href
    @HtmlField(cssPath = ".aNxt")
    private String nextUrl;

    public String getNextUrl() {
        return nextUrl;
    }

    public void setNextUrl(String nextUrl) {
        this.nextUrl = nextUrl;
    }

    public List<String> getUrl() {
        return url;
    }

    public void setUrl(List<String> url) {
        this.url = url;
    }

    public HttpRequest getHttpRequest() {
        return httpRequest;
    }

    public void setHttpRequest(HttpRequest httpRequest) {
        this.httpRequest = httpRequest;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public List<String> getJjrname() {
        return jjrname;
    }

    public void setJjrname(List<String> jjrname) {
        this.jjrname = jjrname;
    }



    public static void main(String[] args){
        GeccoEngine.create().classpath("com.geccocrawler.gecco.demo.anjuke").thread(50).start("http://xm.anjuke.com/tycoon/p1/").run();
    }

}
